 <script type="text/javascript"><!--//--><![CDATA[//><!--

	var grid_reload = function(){
		$('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
	};

	$(document).ready(function() {
		// Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center', rowspan:2},	
				{ field : 'no_tagihan_listrik', title : 'No Tagihan Listrik', width:150, sortable:true, rowspan:2},
				{ field : 'tgl_bayar', title : 'Tanggal Bayar', width:130, sortable:true, rowspan:2},
				{ field : 'no_bukti_pembayaran', title : 'No Pembayaran', width:130, sortable:true, rowspan:2},
				{ field : 'nama_tenant', title : 'Nama Tenant', width:130, sortable:true, rowspan:2},
				{ field : 'no_toko', title : 'No toko', width:100, sortable:true, rowspan:2},
				{ field : 'jenis_usaha', title : 'Jenis Usaha', width:200, sortable:true, rowspan:2},
				{ field : 'lokasi_tempat', title : 'Lokasi Tempat', width:200, sortable:true, rowspan:2},
				{ field : 'periode_pembayaran', title : 'Periode Penagihan', width:200, sortable:true, rowspan:2},
				{ field : 'status_bayar', title : 'Status Bayar', width:100, sortable:true, rowspan:2},
				{ field : 'kwh_awal_meter', title : 'Kwh Awal Meter', width:200, sortable:true, rowspan:2},
				{ field : 'kwh_akhir_meter', title : 'Kwh Akhir Meter', width:200, sortable:true, rowspan:2},
				{ field : 'kwh_terpakai', title : 'Kwh Terpakai', width:200, sortable:true, rowspan:2},
				{ field : 'tarif_per_kwh', title : 'Tarif Per Kwh', width:200, sortable:true, rowspan:2},	
				{ field : 'jumlah_pemakaian', title : 'Jumlah Pemakaian', width:200, sortable:true, rowspan:2},
				{ field : 'mcb', title : 'MCB yang Terpakai', width:200, sortable:true, rowspan:2},
				{ field : 'biaya_beban', title : 'Biaya Beban', width:200, sortable:true, rowspan:2},
				{ field : 'jumlah_biaya_beban', title : 'Jumlah Biaya Beban', width:200, sortable:true, rowspan:2},
				{ field : 'total_tagihan', title : 'Total Tagihan', width:200, sortable:true, rowspan:2},
				]]
		});
	
	// Set Action Button
        var buttons = [
                        // ----- >> Add Button
                        { label: 'Add', icon: 'add', onclick: function() {
							loadPage(gs_path + '/' + controller + '/create/');
                        }},
                        
                        // ----- >> Edit Button
					    { label: 'Edit', icon: 'edit', onclick: function() {
					        var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								loadPage(gs_path + '/' + controller + '/edit/?no_tagihan_listrik='+urlencode(oSel.no_tagihan_listrik)+'&& id_lokasi='+urlencode(oSel.id_lokasi)+'&& no_tenant='+urlencode(oSel.no_tenant));
					        } 
					    }},

					    // ----- >> Delete Button
						{label: 'Delete', icon: 'delete', onclick: function() { 
							var oSel = $('#datagrid').datagrid('getSelected'); 
							if (oSel == null) { 
								$.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
							} else { 
								deleteData(['no_tagihan_listrik']);
							} 
					    }} ];
        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
	});
//--><!]]></script>

<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>
